package wli.app.util;

public class StringStatistics implements Comparable<StringStatistics> {
	private String name = null;
	private int total = 0;

	public void setName(String name) {
		this.name = name;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public String getName() {
		return this.name;
	}

	public int getTotal() {
		return this.total;
	}

	public int compareTo(StringStatistics other) {
		if (!(other instanceof StringStatistics)) {
			throw new ClassCastException("Invalid object");
		}

		int other_total = other.getTotal();

		if (other_total > total)
			return 1;
		else if (other_total < total)
			return -1;
		else {
			return name.compareTo(other.getName());
		}
	}
}
